package proxyModel;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class Test {

    public static void main(String[] args) {
        Subject subject=new RealSubject();

        MyinvocationHandler handler=new MyinvocationHandler(subject);

        ClassLoader loader=subject.getClass().getClassLoader();

        Subject subject1=DynamicProxy.newProxyInstance(loader,subject.getClass().getInterfaces(),handler);

        subject1.doSomething("做完了");
    }
}
